import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

/// 点击计数功能

class ClickCount extends StatefulWidget {

  final String title;


  ClickCount({Key? key, required this.title}) : super(key: key);

  @override
  _ClickCountState createState() => _ClickCountState();

}


class _ClickCountState extends State<ClickCount> {
  int _counter = 0;

  _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(

      body: Center(
        child: Column(
          children: [
            Text("$_counter")
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add)
      )
    );
  }
}